Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

colorjs.io

Package Overview
Dependencies
Maintainers
0
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorjs.io

Let’s get serious about color

  • 0.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
530K
increased by15.15%
Maintainers
0
Weekly downloads
 
Created

What is colorjs.io?

colorjs.io is a comprehensive library for color manipulation and conversion. It supports a wide range of color spaces and provides utilities for color mixing, contrast checking, and more.

What are colorjs.io's main functionalities?

Color Conversion

This feature allows you to convert colors between different color spaces. In the example, the color 'red' is converted to the LCH color space.

const Color = require('colorjs.io');
const color = new Color('red');
console.log(color.to('lch').toString());

Color Manipulation

This feature allows you to manipulate colors, such as lightening or darkening them. In the example, the color 'blue' is lightened by 20%.

const Color = require('colorjs.io');
const color = new Color('blue');
const lighterColor = color.lighten(0.2);
console.log(lighterColor.toString());

Color Mixing

This feature allows you to mix two colors together. In the example, 'red' and 'blue' are mixed in equal parts to create a new color.

const Color = require('colorjs.io');
const color1 = new Color('red');
const color2 = new Color('blue');
const mixedColor = color1.mix(color2, 0.5);
console.log(mixedColor.toString());

Contrast Checking

This feature allows you to check the contrast ratio between two colors. In the example, the contrast ratio between 'white' and 'black' is calculated.

const Color = require('colorjs.io');
const color1 = new Color('white');
const color2 = new Color('black');
console.log(color1.contrast(color2));

Other packages similar to colorjs.io

Keywords

FAQs

Package last updated on 26 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc